float_bits float_half(float_bits f){
	unsigned s = f>>31;
	unsigned exp = 0xff&(f>>23);
	unsigned frac = 0x7fffff&f;
	if((exp^0xff)==0)	return f;
	else if(!exp==1) {
		if(frac&0x3==0x3)frac=(frac>>1)+1;
		else frac = frac>>1;
		return (s<<31)|(exp<<23)|frac;
	}
	else if(!exp==0){
		frac = frac>>1;
		exp = exp-1;
		return (s<<31)|(exp<<23)|(frac&1<<22);
	}
	else {
		exp = (exp-1)<<23;
		return(s<<31)|exp|frac;
	}
}

